<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>点击榜</title>
    <script src="/js/echarts.js"></script>
    <script src="/js/jquery-2.1.1.min.js"></script>
</head>
<body>
<!-- 为ECharts准备一个具备大小（宽高）的Dom -->
<div id="main" style="width: 1200px;height:600px;"></div>
<script type="text/javascript">
    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('main'));
    //发起get请求
    $.get('/echars/getTwo', function (data) {
        myChart.setOption({
            xAxis: {data: data.categories},
            series: [{data: data.data},{data: data.data}],

        })
    });
    // 指定图表的配置项和数据
    myChart.setOption({
        title: {
            text: '博文点击量排行榜',
            link:"https://www.baidu.com",
            subtext:"大众"
        },
        tooltip: {

            formater:"作者"
        },
        toolbox: {
            show: true,
            feature: {
                dataZoom: {
                    yAxisIndex: 'none'
                },
                dataView: {readOnly: false},
                magicType: {type: ['line', 'bar']},
                restore: {},
                saveAsImage: {}
            }
        },
        legend: {
            data: ['总点击量']
        },
        xAxis: {
            data: []
        },
        yAxis: {},
        series: [{
            name: '名字',
            type: 'bar',
            data: []
        },{
            name: '名字',
            type: 'line',
            data: []
        }]
    });

</script>

</body>
</html>